home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / program / vbterm.zip / VT100.BAS < prev   
BASIC Source File  |  1991-10-04  |  18KB  |  660 lines

  1. Declare Sub ScrollWindow Lib "USER" (ByVal hWnd As Integer, ByVal XAmount As Integer, ByVal YAmount As Integer, ByVal lpRect As Long, ByVal lpClipRect As Long)
  2. Declare Function GetMapMode Lib "GDI" (ByVal hDC As Integer) As Integer
  3. Declare Function SetMapMode Lib "GDI" (ByVal hDC As Integer, ByVal nMapMode As Integer) As Integer
  4. Declare Function SetWindowExt Lib "GDI" (ByVal hDC As Integer, ByVal X As Integer, ByVal Y As Integer) As Long
  5. Declare Function SetViewportExt Lib "GDI" (ByVal hDC As Integer, ByVal X As Integer, ByVal Y As Integer) As Long
  6.  
  7. '======================= Mapping Modes ====================
  8. Const MM_TEXT = 1
  9. Const MM_LOMETRIC = 2
  10. Const MM_HIMETRIC = 3
  11. Const MM_LOENGLISH = 4
  12. Const MM_HIENGLISH = 5
  13. Const MM_TWIPS = 6
  14. Const MM_ISOTROPIC = 7
  15. Const MM_ANISOTROPIC = 8
  16.  
  17.  
  18. Declare Function BitBlt Lib "GDI" (ByVal hDestDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal nwidth As Integer, ByVal nheight As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal dwRop As Long) As Integer
  19. Declare Function PatBlt Lib "GDI" (ByVal hDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal nwidth As Integer, ByVal nheight As Integer, ByVal dwRop As Long) As Integer
  20.  
  21. '=================== Ternary raster operations ============
  22. Const SRCCOPY = &HCC0020         ' (DWORD) dest = source
  23. Const SRCPAINT = &HEE0086        ' (DWORD) dest = source OR dest
  24. Const SRCAND = &H8800C6          ' (DWORD) dest = source AND dest
  25. Const SRCINVERT = &H660046       ' (DWORD) dest = source XOR dest
  26. Const SRCERASE = &H440328        ' (DWORD) dest = source AND (NOT dest )
  27. Const NOTSRCCOPY = &H330008      ' (DWORD) dest = (NOT source)
  28. Const NOTSRCERASE = &H1100A6     ' (DWORD) dest = (NOT src) AND (NOT dest)
  29. Const MERGECOPY = &HC000CA       ' (DWORD) dest = (source AND pattern)
  30. Const MERGEPAINT = &HBB0226      ' (DWORD) dest = (NOT source) OR dest
  31. Const PATCOPY = &HF00021         ' (DWORD) dest = pattern
  32. Const PATPAINT = &HFB0A09        ' (DWORD) dest = DPSnoo
  33. Const PATINVERT = &H5A0049       ' (DWORD) dest = pattern XOR dest
  34. Const DSTINVERT = &H550009       ' (DWORD) dest = (NOT dest)
  35. Const BLACKNESS = &H42&          ' (DWORD) dest = BLACK
  36. Const WHITENESS = &HFF0062       ' (DWORD) dest = WHITE
  37.  
  38. '
  39. '   Calls to output text
  40. '
  41. Declare Function TextOut Lib "GDI" (ByVal hDC%, ByVal X%, ByVal Y%, ByVal lpString$, ByVal nCount%) As Integer
  42.  
  43. '
  44. '   Set text to transparent or opaque
  45. '
  46. Declare Function SetBkMode Lib "GDI" (ByVal hDC%, ByVal nmode%) As Integer
  47.  
  48. Const TRANSPARENT = 1
  49. Const OPAQUE = 2
  50.  
  51. '
  52. '   Color management
  53. '
  54. Declare Function GetTextColor Lib "GDI" (ByVal hDC%) As Long
  55. Declare Function SetTextColor Lib "GDI" (ByVal hDC%, ByVal newcolor As Long) As Long
  56.  
  57. Declare Function GetBkColor Lib "GDI" (ByVal hDC%) As Long
  58. Declare Function SetBkColor Lib "GDI" (ByVal hDC%, ByVal newcolor As Long) As Long
  59.  
  60. Dim TermTextColor As Long
  61. Dim TermBkColor As Long
  62.  
  63. Dim ScrImage(24) As String
  64. Dim ScrAttr(24) As String
  65. Dim Normal80 As String
  66. Dim curAttr As String
  67.  
  68.  
  69. '
  70. '   Current Buffered Text
  71. '
  72.  
  73. Dim outstr As String
  74. Dim outx As Integer
  75. Dim outlen As Integer
  76.  
  77. '
  78. '   Flag to indicate that we're ready to run
  79. '
  80. Dim FlagInit As Integer
  81.  
  82. Dim curx As Integer
  83. Dim cury As Integer
  84.  
  85. Dim InEscape As Integer     ' Processing an escape seq?
  86. Dim EscString As String     ' String so far
  87.  
  88. Dim charHeight As Integer
  89. Dim charWidth As Integer
  90.  
  91. Dim CurState As Integer
  92.  
  93. Sub term_init ()
  94.  
  95.     curx = 0
  96.     cury = 0
  97.  
  98.     TTY.ScaleMode = 3
  99.     charHeight = TTY.TextHeight("M")
  100.     charWidth = TTY.TextWidth("M")
  101.  
  102.     TTY.ScaleMode = 0
  103.     TTY.Scale (0, 0)-(79, 24)
  104.     'nMapMode% = SetMapMode(TTY.hDC, MM_ANISOTROPIC)
  105.     'lExt& = SetWindowExt(TTY.hDC, 1, 1)
  106.     'lExt& = SetViewportExt(TTY.hDC, charWidth, charHeight)
  107.  
  108.     InEscape = 0
  109.     CurState = 0
  110.  
  111.  
  112.     r% = SetBkMode(TTY.hDC, OPAQUE)
  113.     TTY.forecolor = QBColor(0)
  114.     TTY.backcolor = QBColor(15)
  115.     TermTextColor = GetTextColor(TTY.hDC)
  116.     TermBkColor = GetBkColor(TTY.hDC)
  117.     disp_cursor
  118.  
  119.     Normal80 = String$(80, "0")
  120.  
  121.     For i% = 1 To 24
  122.         ScrImage(i%) = Space$(80)
  123.         ScrAttr(i%) = Normal80
  124.     Next i%
  125.  
  126.     curAttr = "0"
  127.  
  128.     FlagInit = -1
  129. End Sub
  130.  
  131. Sub disp_cursor ()
  132.  
  133.     '------------------------------------------------------------------------
  134.     '   disp_cursor
  135.     '
  136.     '   display the inverted block cursor on the screen.  currently uses
  137.     '   BitBlt, but seems like it could use PatBlt instead.
  138.     '------------------------------------------------------------------------
  139.  
  140.     If CurState Then
  141.         Exit Sub
  142.     End If
  143.  
  144.     sx% = curx * charWidth
  145.     sy% = cury * charHeight
  146.     If TTY.WindowState <> MINIMIZED Then
  147.        r% = PatBlt(TTY.hDC, sx%, sy%, charWidth, charHeight, DSTINVERT)
  148.     End If
  149.  
  150.     CurState = TRUE
  151.  
  152. End Sub
  153.  
  154. Sub hide_cursor ()
  155.  
  156.     If CurState = 0 Then Exit Sub
  157.  
  158.     sx% = curx * charWidth
  159.     sy% = cury * charHeight
  160.     If TTY.WindowState <> 1 Then
  161.         r% = PatBlt(TTY.hDC, sx%, sy%, charWidth, charHeight, DSTINVERT)
  162.     End If
  163.  
  164.     CurState = FALSE
  165.  
  166. End Sub
  167.  
  168. Sub scroll_up ()
  169.     Dim wid As Integer
  170.     Dim High As Integer
  171.     Dim cHigh As Integer
  172.  
  173. '    wid = TTY.ScaleWidth
  174. '    cHigh = 1
  175. '    High = 23 * cHigh
  176.  
  177. '    If (High > TTY.ScaleHeight) Then
  178. '        High = TTY.ScaleHeight
  179. '    End If
  180.  
  181. '    If TTY.WindowState <> 1 Then
  182. '        ScrollWindow TTY.hWnd, 0, -cHigh, 0, 0
  183. '        ' r% = BitBlt(TTY.hDC, 0, 0, wid, High, TTY.hDC, 0, cHigh, SRCCOPY)
  184. '        r% = PatBlt(TTY.hDC, 0, High, wid, cHigh, WHITENESS)
  185. '    End If
  186.  
  187.     For i% = 1 To 23
  188.         ScrImage(i%) = ScrImage(i% + 1)
  189.         ScrAttr(i%) = ScrAttr(i% + 1)
  190.     Next i%
  191.  
  192.     ScrImage(24) = Space$(80)
  193.     ScrAttr(24) = Normal80
  194.  
  195.     RedrawScreen
  196.  
  197. End Sub
  198.  
  199. Sub term_put (buf As String, cnt As Integer)
  200.  
  201.     Dim i As Integer
  202.     Dim ch As Integer
  203.  
  204.     hide_cursor
  205.  
  206.     outstr = ""
  207.     outlen = 0
  208.     outx = curx
  209.  
  210.     For i = 1 To cnt
  211.  
  212.         ch = &H7F And Asc(Mid$(buf, i, 1))
  213.  
  214.         If (InEscape) Then
  215.             Call AddEscape(ch)
  216.             outx = curx
  217.         Else
  218.             Select Case ch
  219.  
  220.             Case 13
  221.                 curx = 0
  222.                 If (outlen <> 0) Then WriteText
  223.                 outx = 0
  224.  
  225.             Case 10
  226.                 If (outlen <> 0) Then WriteText     '   flush output buffer
  227.  
  228.                 cury = cury + 1                     '   goto next line
  229.                 If (cury > 23) Then                 '   if line left on scrn
  230.                     Call scroll_up                  '   ..  scroll upwards
  231.                     cury = 23                       '   ..  use blank line
  232.                 End If
  233.  
  234.             Case 8
  235.                 If (outlen <> 0) Then WriteText     '   flush output buffer
  236.  
  237.                 If curx > 0 Then                    '   if not at line begin
  238.                     curx = curx - 1                 '   ..  adjust back 1 spc
  239.                     outx = curx
  240.                 End If
  241.  
  242.             Case 7
  243.                 Beep
  244.  
  245.             Case 27
  246.                 If (outlen <> 0) Then WriteText
  247.                 Call StartEscape
  248.  
  249.             Case Else
  250.                 If (ch > 31) Then
  251.                     outstr = outstr + Chr$(ch)
  252.                     outlen = outlen + 1
  253.                     Mid$(ScrImage(cury + 1), curx + 1, 1) = Chr$(ch)
  254.                     Mid$(ScrAttr(cury + 1), curx + 1, 1) = curAttr
  255.                     curx = curx + 1
  256.                     If (curx >= 80) Then
  257.                         Call WriteText
  258.                         curx = 79
  259.                     End If
  260.                 End If
  261.             End Select
  262.         End If
  263.     Next i
  264.  
  265.     If (outlen <> 0) Then WriteText
  266.  
  267. End Sub
  268.  
  269. Sub StartEscape ()
  270.     InEscape = -1
  271.     EscString = ""
  272. End Sub
  273.  
  274. Sub AddEscape (ch As Integer)
  275.  
  276.     Dim c As String
  277.     Dim l As Long
  278.  
  279.     c = Chr$(ch)
  280.     If EscString = "" And c <> "[" Then
  281.         InEscape = 0
  282.         Exit Sub
  283.     End If
  284.  
  285.     EscString = EscString + c
  286.     If (LCase$(c) = UCase$(c)) Then
  287.         ' Not a letter ...
  288.         If Len(EscString) > 16 Then InEscape = 0
  289.         Exit Sub
  290.     End If
  291.  
  292.     Select Case c
  293.     Case "H", "f"
  294.         EscString = Mid$(EscString, 2)
  295.         cury = Val(PopArg(EscString)) - 1
  296.         If (cury < 0) Then cury = 0
  297.         curx = Val(EscString) - 1
  298.         If (curx < 0) Then curx = 0
  299.  
  300.     Case "K"
  301.         Select Case Val(Mid$(EscString, 2))
  302.         Case 0
  303.             Call erase_eol
  304.         Case 1
  305.             Call erase_bol
  306.         Case 2
  307.             Call erase_line
  308.         End Select
  309.  
  310.     Case "J"
  311.         Select Case Val(Mid$(EscString, 2))
  312.         Case 0
  313.             Call erase_eos
  314.         Case 1
  315.             Call erase_bos
  316.         Case 2
  317.             Call erase_screen
  318.         End Select
  319.  
  320.     Case "m"
  321.         EscString = Mid$(EscString, 2)
  322.         Do
  323.             Call SetAttr(PopArg(EscString))
  324.         Loop While EscString <> ""
  325.  
  326.     Case "A", "B"
  327.         EscString = Mid$(EscString, 2)
  328.         yDiff% = Val(PopArg(EscString))
  329.         If yDiff% = 0 Then yDiff% = 1
  330.         If c = "A" Then yDiff% = 0 - yDiff%
  331.         cury = cury + yDiff%
  332.         If (cury < 0) Then cury = 0
  333.  
  334.     Case "C", "D"
  335.         EscString = Mid$(EscString, 2)
  336.         xDiff% = Val(PopArg(EscString))
  337.         If xDiff% = 0 Then xDiff% = 1
  338.         If c = "D" Then xDiff% = 0 - xDiff%
  339.         curx = curx + xDiff%
  340.         If (curx < 0) Then curx = 0
  341.         If (curx > 79) Then curx = 79
  342.  
  343.     End Select
  344.  
  345.     InEscape = 0
  346.     EscString = ""
  347.  
  348. End Sub
  349.  
  350. Function PopArg (s As String) As String
  351. '
  352. '   PopArg takes the next argument (digits up to a ;) and
  353. '   returns it.  It also removes the arg and the ; from
  354. '   the "s"
  355.  
  356.     i% = InStr(s, ";")
  357.     If i% = 0 Then
  358.         PopArg = s
  359.         s = ""
  360.         Exit Function
  361.     End If
  362.  
  363.     PopArg = Left$(s, i% - 1)
  364.     s = Mid$(s$, i% + 1)
  365.  
  366. End Function
  367.  
  368. Sub erase_bos ()
  369.  
  370.     '------------------------------------------------------------------------
  371.     '   erase_bos
  372.     '
  373.     '   erase all lines from beginning of screen to and including current
  374.     '------------------------------------------------------------------------
  375.     Dim wid As Integer
  376.     Dim High As Integer
  377.     Dim cHigh As Integer
  378.  
  379.     '------------------------------------------------------------------------
  380.     '   erase from the beginning of the line. if current line is 0, then exit
  381.     '------------------------------------------------------------------------
  382.     Call erase_bol
  383.     If (cury = 0) Then
  384.         Exit Sub
  385.     End If
  386.  
  387.     '------------------------------------------------------------------------
  388.     '   calculate height of block to erase
  389.     '------------------------------------------------------------------------
  390.     wid = TTY.Width
  391.     cHigh = TTY.TextHeight("M")
  392.     High = (cury - 1) * cHigh
  393.  
  394.     If TTY.WindowState <> 1 Then
  395.         r% = PatBlt(TTY.hDC, 0, 0, wid, High, WHITENESS)
  396.     End If
  397.  
  398.     '------------------------------------------------------------------------
  399.     '   reset screen buffer contents
  400.     '------------------------------------------------------------------------
  401.     For Y% = 1 To cury
  402.         ScrImage(Y%) = Space$(80)
  403.         ScrAttr(Y%) = Normal80
  404.     Next Y%
  405.  
  406. End Sub
  407.  
  408. Sub erase_line ()
  409.  
  410. '   Erase Line
  411.  
  412.     Dim wid As Integer
  413.     Dim High As Integer
  414.     Dim cHigh As Integer
  415.     Dim StartX As Integer
  416.  
  417.     wid = TTY.Width
  418.     cHigh = TTY.TextHeight("M")
  419.     High = cury * cHigh
  420.  
  421.     If TTY.WindowState <> 1 Then
  422.         r% = PatBlt(TTY.hDC, 0, High, wid, cHigh, WHITENESS)
  423.     End If
  424.  
  425.     ScrImage(cury + 1) = Space$(80)
  426.     ScrAttr(cury + 1) = Normal80
  427.  
  428. End Sub
  429.  
  430. Sub erase_eos ()
  431. '
  432. '   Erase to end of screen
  433. '
  434.     Dim wid As Integer
  435.     Dim High As Integer
  436.     Dim cHigh As Integer
  437.     Dim StartY As Integer
  438.  
  439.     Call erase_eol
  440.  
  441.     If (cury = 23) Then Exit Sub
  442.  
  443.     wid = TTY.ScaleWidth
  444.     cHigh = TTY.TextHeight("M")
  445.     StartY = (cury + 1) * cHigh
  446.     High = 24 * cHigh - StartY
  447.  
  448.  
  449.     If TTY.WindowState <> 1 Then
  450.         r% = PatBlt(TTY.hDC, 0, StartY, wid, High, WHITENESS)
  451.     End If
  452.  
  453.     For Y% = cury + 2 To 24
  454.         ScrImage(Y%) = Space$(80)
  455.         ScrAttr(Y%) = Normal80
  456.     Next Y%
  457.  
  458. End Sub
  459.  
  460. Sub erase_eol ()
  461. '
  462. '   Erase to End of Line
  463. '
  464.     Dim wid As Integer
  465.     Dim High As Integer
  466.     Dim cHigh As Integer
  467.     Dim StartX As Integer
  468.  
  469.     wid = TTY.ScaleWidth
  470.     cHigh = charHeight
  471.     High = cury * charHeight
  472.     StartX = curx * charWidth
  473.  
  474.     If TTY.WindowState <> 1 Then
  475.         r% = PatBlt(TTY.hDC, StartX, High, wid - StartX, cHigh, WHITENESS)
  476.     End If
  477.  
  478.     Mid$(ScrImage(cury + 1), curx + 1, 80 - curx) = Space$(80 - curx)
  479.     Mid$(ScrAttr(cury + 1), curx + 1, 80 - curx) = String$(80 - curx, "0")
  480.  
  481. End Sub
  482.  
  483. Sub erase_bol ()
  484.  
  485.     '------------------------------------------------------------------------
  486.     '   erase_bol
  487.     '
  488.     '   erase from beginning of current line
  489.     '------------------------------------------------------------------------
  490.     Dim wid As Integer
  491.     Dim High As Integer
  492.     Dim cHigh As Integer
  493.  
  494.  
  495.     cHigh = charHeight
  496.     High = cury * charHeight
  497.     wid = curx * charWidth
  498.  
  499.     If TTY.WindowState <> 1 Then
  500.         r% = PatBlt(TTY.hDC, 0, High, wid, cHigh, WHITENESS)
  501.     End If
  502.  
  503.     Mid$(ScrImage(cury + 1), 1, curx + 1) = Space$(curx + 1)
  504.     Mid$(ScrAttr(cury + 1), 1, curx + 1) = String$(curx + 1, "0")
  505.  
  506. End Sub
  507.  
  508. Sub erase_screen ()
  509.  
  510.     TTY.Cls
  511.     For Y% = 1 To 24
  512.         ScrImage(Y%) = Space$(80)
  513.         ScrAttr(Y%) = Normal80
  514.     Next Y%
  515.  
  516. End Sub
  517.  
  518. Sub WriteText ()
  519.  
  520.     If TTY.WindowState <> MINIMIZED Then
  521.         r% = TextOut(TTY.hDC, outx * charWidth, cury * charHeight, outstr, outlen)
  522.     End If
  523.  
  524.     outstr = ""
  525.     outlen = 0
  526.     outx = outx + outlen
  527.  
  528. End Sub
  529.  
  530. Sub RedrawScreen ()
  531.  
  532.     Dim oldcur As Integer
  533.     Dim oldattr As String
  534.  
  535.     If FlagInit <> -1 Then Exit Sub
  536.     If TTY.WindowState = 1 Then Exit Sub
  537.  
  538.     oldcur = CurState
  539.     oldattr = curAttr
  540.  
  541.     Call hide_cursor
  542.     Call SetAttr("0")
  543.  
  544.     For Y% = 1 To 24
  545.  
  546.         If (ScrAttr(Y%) = Normal80) Then
  547.             r% = TextOut(TTY.hDC, 0, (Y% - 1) * charHeight, ScrImage(Y%), 80)
  548.         Else
  549.             
  550.             For X% = 1 To 80
  551.                 If (Mid$(ScrAttr(Y%), X%, 1) <> curAttr) Then
  552.                     Call SetAttr(Mid$(ScrAttr(Y%), X%, 1))
  553.                 End If
  554.                 r% = TextOut(TTY.hDC, (X% - 1) * charWidth, (Y% - 1) * charHeight, Mid$(ScrImage(Y%), X%, 1), 1)
  555.  
  556.             Next X%
  557.         End If
  558.         
  559.         r% = DoEvents()
  560.  
  561.     Next Y%
  562.  
  563.     Call SetAttr(oldattr)
  564.     If oldcur <> 0 Then Call disp_cursor
  565.  
  566. End Sub
  567.  
  568. Sub SetAttr (ch As String)
  569.  
  570.     Select Case Val(ch)
  571.  
  572.             '===============================================================
  573.             
  574.             Case 0  '   Normal
  575.                 'TTY.fontbold = FALSE
  576.                 TTY.fontunderline = FALSE
  577.                 'TTY.fontitalic = FALSE
  578.                 oldColor = SetTextColor(TTY.hDC, TermTextColor)
  579.                 oldColor = SetBkColor(TTY.hDC, TermBkColor)
  580.  
  581.             Case 1  '   Bold
  582.                 'TTY.fontbold = TRUE
  583.                 oldColor = SetTextColor(TTY.hDC, QBColor(9))
  584.  
  585.             Case 5  '   Blinking
  586.                 'TTY.fontitalic = TRUE
  587.                 oldColor = SetTextColor(TTY.hDC, QBColor(3))
  588.  
  589.             Case 4  '   Underscore
  590.                 TTY.fontunderline = TRUE
  591.  
  592.             Case 7  '   Reverse Video
  593.                 oldColor = SetTextColor(TTY.hDC, TermBkColor)
  594.                 oldColor = SetBkColor(TTY.hDC, TermTextColor)
  595.  
  596.             Case 8  '   Cancel (Invisible)
  597.                 oldColor = SetTextColor(TTY.hDC, TermBkColor)
  598.                 oldColor = SetBkColor(TTY.hDC, TermBkColor)
  599.  
  600.             '===============================================================
  601.  
  602.             Case 30 '   Black Foreground
  603.                 oldColor = SetTextColor(TTY.hDC, QBColor(0))
  604.  
  605.             Case 31 '   Red Foreground
  606.                 oldColor = SetTextColor(TTY.hDC, QBColor(4))
  607.  
  608.             Case 32 '   Green Foreground
  609.                 oldColor = SetTextColor(TTY.hDC, QBColor(2))
  610.  
  611.             Case 33 '   Yellow Foreground
  612.                 oldColor = SetTextColor(TTY.hDC, QBColor(14))
  613.  
  614.             Case 34 '   Blue Foreground
  615.                 oldColor = SetTextColor(TTY.hDC, QBColor(1))
  616.  
  617.             Case 35 '   Magenta Foreground
  618.                 oldColor = SetTextColor(TTY.hDC, QBColor(5))
  619.  
  620.             Case 36 '   Cyan Foreground
  621.                 oldColor = SetTextColor(TTY.hDC, QBColor(3))
  622.  
  623.             Case 37 '   White Foreground
  624.                 oldColor = SetTextColor(TTY.hDC, QBColor(15))
  625.  
  626.             '===============================================================
  627.  
  628.             Case 40 '   Black Background
  629.                 oldColor = SetBkColor(TTY.hDC, QBColor(0))
  630.  
  631.             Case 41 '   Red Background
  632.                 oldColor = SetBkColor(TTY.hDC, QBColor(4))
  633.  
  634.             Case 42 '   Green Background
  635.                 oldColor = SetBkColor(TTY.hDC, QBColor(2))
  636.  
  637.             Case 43 '   Yellow Background
  638.                 oldColor = SetBkColor(TTY.hDC, QBColor(14))
  639.  
  640.             Case 44 '   Blue Background
  641.                 oldColor = SetBkColor(TTY.hDC, QBColor(1))
  642.  
  643.             Case 45 '   Magenta Background
  644.                 oldColor = SetBkColor(TTY.hDC, QBColor(5))
  645.  
  646.             Case 46 '   Cyan Background
  647.                 oldColor = SetBkColor(TTY.hDC, QBColor(3))
  648.  
  649.             Case 47 '   White Background
  650.                 oldColor = SetBkColor(TTY.hDC, QBColor(15))
  651.  
  652.             Case Else
  653.                 Exit Sub
  654.     End Select
  655.  
  656.     curAttr = ch
  657.  
  658. End Sub
  659.  
  660.